<template>
    <div class="horn-bar">
        <img class="horn-icon" src="~resources/good_news.png" alt="" mode="aspectFill" />
        <swiper class="swiper-wrapper horn-wrapper" :options="hornSwiperOption">
            <swiper-slide class="swiper-slide b-swiper-slide" v-for="(item, index) in list" :key="index">
                <span class="horn-swiper-txt" @click="bannerClick(item, 'notice', index)"> {{ item.content }}</span>
            </swiper-slide>
        </swiper>
    </div>
</template>
<script>
// import 'public/components/banner-swiper/swiper-bar.scss';

export default {
    name: 'hornSwiper',
    data() {
        return {
            hornSwiperOption: {
                autoplay: {
                    delay: 2000, //自动切换的时间间隔，单位ms
                    waitForTransition: true, //等待过渡完毕。自动切换会在slide过渡完毕后才开始计时。
                },
                direction: 'vertical',
                loop: true,
                allowTouchMove: false,
            },
        };
    },
    props: {
        list: {
            type: Array,
            default() {
                return [];
            },
        },
    },
    methods: {
        bannerClick(item, type, index) {
            this.$emit('bannerClick', item, type, index);
        },
    },
};
</script>

<style lang="scss" scoped>
.horn-swiper-txt {
    display: block;
    text-align: left;
    color: #762b00;
    font-size: 14px;
    word-break: keep-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    lines: 1;
}
</style>
